﻿Imports System.Windows.Forms

Public Class PreviousPhase
    Private _phase As String

    Public Property Phase() As String
        Get
            Return _phase
        End Get
        Set(ByVal value As String)
            _phase = value
        End Set
    End Property

    Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        Me.Phase = ""
    End Sub

    Sub New(ByVal phase As String)
        InitializeComponent()

        Me.Phase = phase
    End Sub

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        My.Settings.PreviousPhaseWarning = Me.CheckBox1.Checked
        Me.DialogResult = System.Windows.Forms.DialogResult.Yes
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        My.Settings.PreviousPhaseWarning = Me.CheckBox1.Checked
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub PreviousPhase_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Label1.Text = "By returning to phase " & PreviousPhase(Me.Phase) & " all characters will be reset to this action phase. All characters that have previously acted during phase " & Me.Phase & " and " & PreviousPhase(Me.Phase) & " will be reset. There currently is no functionality to reset Stun, Body, or other stats to previous values. This will have to be done manually for each character. Proceed?"
    End Sub

    Private Function PreviousPhase(ByVal phase As String) As String
        If phase = "11" Then
            Return "12+"
        ElseIf phase = "12+" Then
            Return "12"
        ElseIf phase = "12" Then
            Return "1"
        Else
            Return (CInt(phase) + 1).ToString
        End If
    End Function
End Class
